﻿using System;
using System.Collections.Generic;
using System.Text;

namespace EasyFramework._CodeTip
{
    class StringSplit
    {
        /// <summary>
        /// 分割字符串为数组
        /// </summary>
        /// <param name="source">源字符串</param>
        /// <param name="isRemainEmpty">是否保留空元素</param>
        /// <returns></returns>
        public string[] Split(string source, bool isRemainEmpty)
        {
            if (isRemainEmpty)
            {
                return source.Split(',');
            }
            else
            {
                //tip
                return source.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            }
        }
    }
}
